<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<title>QSculpt: engine/include/HEdge.h Source File</title>

<link href="tabs.css" rel="stylesheet" type="text/css"/>
<link href="doxygen.css" rel="stylesheet" type="text/css" />

<link href="search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="search/search.js"></script>
<script type="text/javascript">
  $(document).ready(function() { searchBox.OnSelectItem(0); });
</script>

</head>
<body>
<div id="top"><!-- do not remove this div! -->


<div id="titlearea">
<table cellspacing="0" cellpadding="0">
 <tbody>
 <tr style="height: 56px;">
  
  
  <td style="padding-left: 0.5em;">
   <div id="projectname">QSculpt
   &#160;<span id="projectnumber">0.0.1a</span>
   </div>
   
  </td>
  
  
  
 </tr>
 </tbody>
</table>
</div>

<!-- Generated by Doxygen 1.7.5.1 -->
<script type="text/javascript">
var searchBox = new SearchBox("searchBox", "search",false,'Search');
</script>
  <div id="navrow1" class="tabs">
    <ul class="tablist">
      <li><a href="index.html"><span>Main&#160;Page</span></a></li>
      <li><a href="namespaces.html"><span>Namespaces</span></a></li>
      <li><a href="annotated.html"><span>Classes</span></a></li>
      <li class="current"><a href="files.html"><span>Files</span></a></li>
      <li>
        <div id="MSearchBox" class="MSearchBoxInactive">
        <span class="left">
          <img id="MSearchSelect" src="search/mag_sel.png"
               onmouseover="return searchBox.OnSearchSelectShow()"
               onmouseout="return searchBox.OnSearchSelectHide()"
               alt=""/>
          <input type="text" id="MSearchField" value="Search" accesskey="S"
               onfocus="searchBox.OnSearchFieldFocus(true)" 
               onblur="searchBox.OnSearchFieldFocus(false)" 
               onkeyup="searchBox.OnSearchFieldChange(event)"/>
          </span><span class="right">
            <a id="MSearchClose" href="javascript:searchBox.CloseResultsWindow()"><img id="MSearchCloseImg" border="0" src="search/close.png" alt=""/></a>
          </span>
        </div>
      </li>
    </ul>
  </div>
  <div id="navrow2" class="tabs2">
    <ul class="tablist">
      <li><a href="files.html"><span>File&#160;List</span></a></li>
    </ul>
  </div>
<div class="header">
  <div class="headertitle">
<div class="title">engine/include/HEdge.h</div>  </div>
</div>
<div class="contents">
<div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 <span class="comment">/*</span>
<a name="l00002"></a>00002 <span class="comment"> *  HEdge.h</span>
<a name="l00003"></a>00003 <span class="comment"> *  QSculpt</span>
<a name="l00004"></a>00004 <span class="comment"> *</span>
<a name="l00005"></a>00005 <span class="comment"> *  Created by Roberto Cabral on 12/4/09.</span>
<a name="l00006"></a>00006 <span class="comment"> *  Copyright 2009 __MyCompanyName__. All rights reserved.</span>
<a name="l00007"></a>00007 <span class="comment"> *</span>
<a name="l00008"></a>00008 <span class="comment"> */</span>
<a name="l00009"></a>00009 <span class="preprocessor">#ifndef HEDGE_H_</span>
<a name="l00010"></a>00010 <span class="preprocessor"></span><span class="preprocessor">#define HEDGE_H_</span>
<a name="l00011"></a>00011 <span class="preprocessor"></span>
<a name="l00012"></a>00012 <span class="keyword">class </span><a class="code" href="class_vertex.html">Vertex</a>;
<a name="l00013"></a>00013 
<a name="l00014"></a>00014 <span class="preprocessor">#include &quot;IIterator.h&quot;</span>
<a name="l00015"></a>00015 <span class="preprocessor">#include &quot;Vertex.h&quot;</span>
<a name="l00016"></a>00016 
<a name="l00017"></a>00017 <span class="keyword">class </span><a class="code" href="class_face.html">Face</a>;
<a name="l00018"></a>00018 
<a name="l00019"></a>00019 <span class="keyword">enum</span> EdgeFlags {
<a name="l00020"></a>00020     EF_None     = 0,
<a name="l00021"></a>00021     EF_Selected = 0x00000001,  <span class="comment">/*&lt; Face is selected */</span>
<a name="l00022"></a>00022     EF_Deleted  = 0x00000002,  <span class="comment">/*&lt; Face is marked as deleted */</span>
<a name="l00023"></a>00023     EF_Crease   = 0x00000004,
<a name="l00024"></a>00024     EF_User1    = 0x00100000,  <span class="comment">/*&lt; Reserved to use for the user*/</span>
<a name="l00025"></a>00025     EF_User2    = 0x00200000,  <span class="comment">/*&lt; Reserved to use for the user*/</span>
<a name="l00026"></a>00026     EF_All      = 0xFFFFFFFF
<a name="l00027"></a>00027 };
<a name="l00028"></a>00028 
<a name="l00029"></a><a class="code" href="class_edge.html">00029</a> <span class="keyword">class </span><a class="code" href="class_edge.html">Edge</a> {
<a name="l00030"></a>00030 <span class="keyword">public</span>:
<a name="l00031"></a>00031     <span class="keyword">typedef</span> <a class="code" href="class_edge.html">Edge</a>*   <a class="code" href="class_edge.html">SharedPtr</a>;
<a name="l00032"></a>00032     <span class="keyword">typedef</span> <a class="code" href="class_edge.html">Edge</a>*   <a class="code" href="class_edge.html">WeakPtr</a>;
<a name="l00033"></a>00033     <span class="keyword">typedef</span> <a class="code" href="class_edge.html">Edge</a>*   <a class="code" href="class_edge.html">Ptr</a>;
<a name="l00034"></a>00034 
<a name="l00035"></a>00035 <span class="keyword">private</span>:
<a name="l00036"></a>00036     <span class="keyword">static</span> QAtomicInt NEXT_ID;
<a name="l00037"></a>00037 
<a name="l00038"></a>00038     <span class="keywordtype">size_t</span>         _id;    <span class="comment">// 4</span>
<a name="l00039"></a>00039     EdgeFlags   _flags; <span class="comment">// 4</span>
<a name="l00040"></a>00040     <a class="code" href="class_edge.html">Edge::WeakPtr</a>        _next; <span class="comment">// 4</span>
<a name="l00041"></a>00041     <a class="code" href="class_edge.html">Edge::WeakPtr</a>        _prev; <span class="comment">// 4</span>
<a name="l00042"></a>00042     <a class="code" href="class_edge.html">Edge::WeakPtr</a>        _pair; <span class="comment">// 4</span>
<a name="l00043"></a>00043     <a class="code" href="class_vertex.html">Vertex::WeakPtr</a>      _head; <span class="comment">// 4</span>
<a name="l00044"></a>00044     <a class="code" href="class_vertex.html">Vertex::WeakPtr</a>      _tail; <span class="comment">// 4</span>
<a name="l00045"></a>00045     <a class="code" href="class_face.html">Face</a>        *_face; <span class="comment">// 4</span>
<a name="l00046"></a>00046     <span class="keywordtype">void</span>        *_userData; <span class="comment">// 4</span>
<a name="l00047"></a>00047 
<a name="l00048"></a>00048 <span class="keyword">public</span>:
<a name="l00049"></a>00049     <a class="code" href="class_edge.html">Edge</a>();
<a name="l00050"></a>00050 
<a name="l00051"></a>00051     <a class="code" href="class_edge.html">Edge</a>(<a class="code" href="class_vertex.html">Vertex</a>* <a class="code" href="class_edge.html#a1cd4feb64d154b5fdeb008e904b75a51">tail</a>, <a class="code" href="class_vertex.html">Vertex</a>* <a class="code" href="class_edge.html#a1a3005e40d3e8801cb51a219512cff2d">head</a>);
<a name="l00052"></a>00052 
<a name="l00053"></a>00053     ~<a class="code" href="class_edge.html">Edge</a>();
<a name="l00054"></a>00054 
<a name="l00058"></a><a class="code" href="class_edge.html#ae8b7c4bc269ce61a94aa525f6dc67aeb">00058</a>     <span class="keywordtype">size_t</span> <a class="code" href="class_edge.html#ae8b7c4bc269ce61a94aa525f6dc67aeb">iid</a>()<span class="keyword"> const </span>{ <span class="keywordflow">return</span> _id; }
<a name="l00059"></a>00059 
<a name="l00063"></a><a class="code" href="class_edge.html#aaeba868544b01ddb4ccc986092ea7287">00063</a>     <span class="keywordtype">void</span> <a class="code" href="class_edge.html#aaeba868544b01ddb4ccc986092ea7287">addFlag</a>(EdgeFlags flag) { _flags = (EdgeFlags)(_flags | flag); }
<a name="l00064"></a>00064     <span class="keywordtype">void</span> removeFlag(EdgeFlags flag) { _flags = (EdgeFlags)(_flags &amp; ~flag); }
<a name="l00065"></a>00065     EdgeFlags flags()<span class="keyword"> const </span>{ <span class="keywordflow">return</span> _flags; }
<a name="l00066"></a>00066     <span class="keywordtype">void</span> setFlags(EdgeFlags flags) {_flags = flags; }
<a name="l00067"></a>00067     <span class="keywordtype">bool</span> isFlagSet(EdgeFlags flag) { <span class="keywordflow">return</span> (_flags &amp; flag) != 0;}
<a name="l00068"></a>00068 
<a name="l00072"></a><a class="code" href="class_edge.html#a3abeabec52d89c01f34d034b01dbf9d6">00072</a>     <a class="code" href="class_edge.html">Edge</a>* <a class="code" href="class_edge.html#a3abeabec52d89c01f34d034b01dbf9d6">next</a>()<span class="keyword"> const </span>{ <span class="keywordflow">return</span> _next; }
<a name="l00073"></a>00073     <span class="keywordtype">void</span> setNext(<a class="code" href="class_edge.html">Edge</a>* he) { _next = he; }
<a name="l00074"></a>00074     
<a name="l00075"></a>00075     <a class="code" href="class_edge.html">Edge</a>* prev()<span class="keyword"> const </span>{ <span class="keywordflow">return</span> _prev; }
<a name="l00076"></a>00076     <span class="keywordtype">void</span> setPrev(<a class="code" href="class_edge.html">Edge</a>* he) { _prev = he; }
<a name="l00077"></a>00077 
<a name="l00081"></a><a class="code" href="class_edge.html#a24895540a4004d92c18f43e2fb5ecedd">00081</a>     <a class="code" href="class_edge.html">Edge</a>* <a class="code" href="class_edge.html#a24895540a4004d92c18f43e2fb5ecedd">pair</a>()<span class="keyword"> const </span>{ <span class="keywordflow">return</span> _pair; }
<a name="l00082"></a>00082     <span class="keywordtype">void</span> setPair(<a class="code" href="class_edge.html">Edge</a>* he) { _pair = he; }
<a name="l00083"></a>00083 
<a name="l00087"></a><a class="code" href="class_edge.html#a1a3005e40d3e8801cb51a219512cff2d">00087</a>     <a class="code" href="class_vertex.html">Vertex</a>* <a class="code" href="class_edge.html#a1a3005e40d3e8801cb51a219512cff2d">head</a>()<span class="keyword"> const </span>{ <span class="keywordflow">return</span> _head; }
<a name="l00088"></a>00088     <span class="keywordtype">void</span> setHead(<a class="code" href="class_vertex.html">Vertex</a>* v) { _head = v; }
<a name="l00089"></a>00089 
<a name="l00093"></a><a class="code" href="class_edge.html#a1cd4feb64d154b5fdeb008e904b75a51">00093</a>     <a class="code" href="class_vertex.html">Vertex</a>* <a class="code" href="class_edge.html#a1cd4feb64d154b5fdeb008e904b75a51">tail</a>()<span class="keyword"> const </span>{ <span class="keywordflow">return</span> _tail; }
<a name="l00094"></a>00094     <span class="keywordtype">void</span> setTail(<a class="code" href="class_vertex.html">Vertex</a>* v) { _tail = v; }
<a name="l00095"></a>00095 
<a name="l00099"></a><a class="code" href="class_edge.html#a2929c70f486a9b5bae2dd806d8ff6cb5">00099</a>     <a class="code" href="class_face.html">Face</a>* <a class="code" href="class_edge.html#a2929c70f486a9b5bae2dd806d8ff6cb5">face</a>()<span class="keyword"> const </span>{ <span class="keywordflow">return</span> _face; }
<a name="l00100"></a>00100     <span class="keywordtype">void</span> setFace(<a class="code" href="class_face.html">Face</a>* f) { _face = f; }
<a name="l00101"></a>00101 
<a name="l00105"></a><a class="code" href="class_edge.html#af66224fb864cfbd5fdaf50509b1f81b1">00105</a>     <span class="keywordtype">void</span> <a class="code" href="class_edge.html#af66224fb864cfbd5fdaf50509b1f81b1">setUserData</a>(<span class="keywordtype">void</span> * data) {
<a name="l00106"></a>00106         _userData = data;
<a name="l00107"></a>00107     }
<a name="l00108"></a>00108     
<a name="l00114"></a><a class="code" href="class_edge.html#ab91c2af49397da0e268ba0798a05c407">00114</a>     <span class="keywordtype">void</span> * <a class="code" href="class_edge.html#ab91c2af49397da0e268ba0798a05c407">userData</a>()<span class="keyword"> const </span>{
<a name="l00115"></a>00115         <span class="keywordflow">return</span> _userData;
<a name="l00116"></a>00116     }
<a name="l00117"></a>00117 
<a name="l00118"></a>00118     <span class="keywordtype">bool</span> isEqual(<span class="keyword">const</span> <a class="code" href="class_edge.html">Edge</a>&amp; he) <span class="keyword">const</span>;
<a name="l00119"></a>00119     <span class="keywordtype">bool</span> operator==(<span class="keyword">const</span> <a class="code" href="class_edge.html">Edge</a>&amp; he) <span class="keyword">const</span>;
<a name="l00120"></a>00120     <span class="keywordtype">bool</span> operator!=(<span class="keyword">const</span> <a class="code" href="class_edge.html">Edge</a>&amp; he) <span class="keyword">const</span>;
<a name="l00121"></a>00121 
<a name="l00122"></a>00122     <a class="code" href="class_iterator.html">Iterator&lt;Vertex&gt;</a> vertexIterator();
<a name="l00123"></a>00123 
<a name="l00124"></a>00124     <a class="code" href="class_iterator.html">Iterator&lt;Edge&gt;</a> hedgeIterator();
<a name="l00125"></a>00125 
<a name="l00126"></a>00126 <span class="keyword">private</span>:
<a name="l00127"></a>00127     <span class="keyword">class </span>VertexIterator;
<a name="l00128"></a>00128     <span class="keyword">class </span>HEdgeIterator;
<a name="l00129"></a>00129 
<a name="l00130"></a>00130     <span class="keyword">friend</span> <span class="keyword">class </span>VertexIterator;
<a name="l00131"></a>00131     <span class="keyword">friend</span> <span class="keyword">class </span>HEdgeIterator;
<a name="l00132"></a>00132     <span class="keyword">friend</span> uint qHash(<span class="keyword">const</span> <a class="code" href="class_edge.html">Edge</a>&amp;);
<a name="l00133"></a>00133 };
<a name="l00134"></a>00134 
<a name="l00135"></a>00135 
<a name="l00136"></a><a class="code" href="struct_edge_ptr_comparator.html">00136</a> <span class="keyword">struct </span><a class="code" href="struct_edge_ptr_comparator.html">EdgePtrComparator</a>
<a name="l00137"></a>00137 {
<a name="l00138"></a>00138     <span class="keyword">const</span> <a class="code" href="class_edge.html">Edge</a>* _e;
<a name="l00139"></a>00139 
<a name="l00140"></a>00140     <a class="code" href="struct_edge_ptr_comparator.html">EdgePtrComparator</a>(<span class="keyword">const</span> <a class="code" href="class_edge.html">Edge</a>&amp; e) : _e(&amp;e) {}
<a name="l00141"></a>00141 
<a name="l00142"></a>00142     <span class="keywordtype">bool</span> operator()(<span class="keyword">const</span> <a class="code" href="class_edge.html">Edge</a>* e) {
<a name="l00143"></a>00143         <span class="keywordflow">return</span> (*_e) == (*e);
<a name="l00144"></a>00144     }
<a name="l00145"></a>00145 };
<a name="l00146"></a>00146 
<a name="l00147"></a><a class="code" href="struct_edge_ptr_comparator2.html">00147</a> <span class="keyword">struct </span><a class="code" href="struct_edge_ptr_comparator2.html">EdgePtrComparator2</a>
<a name="l00148"></a>00148 {
<a name="l00149"></a>00149     <span class="keyword">const</span> <a class="code" href="class_vertex.html">Vertex</a> *_tail;
<a name="l00150"></a>00150     <span class="keyword">const</span> <a class="code" href="class_vertex.html">Vertex</a> *_head;
<a name="l00151"></a>00151 
<a name="l00152"></a>00152     <a class="code" href="struct_edge_ptr_comparator2.html">EdgePtrComparator2</a>(<span class="keyword">const</span> <a class="code" href="class_vertex.html">Vertex</a> *tail, <span class="keyword">const</span> <a class="code" href="class_vertex.html">Vertex</a> *head) : _tail(tail), _head(head) {}
<a name="l00153"></a>00153 
<a name="l00154"></a>00154     <span class="keywordtype">bool</span> operator()(<span class="keyword">const</span> <a class="code" href="class_edge.html">Edge</a>* e) {
<a name="l00155"></a>00155         <span class="keywordflow">return</span> (e-&gt;<a class="code" href="class_edge.html#a1a3005e40d3e8801cb51a219512cff2d">head</a>()-&gt;<a class="code" href="class_vertex.html#a4b7d24d9d68ea12c55cb2695dfb70766">iid</a>() == _head-&gt;<a class="code" href="class_vertex.html#a4b7d24d9d68ea12c55cb2695dfb70766">iid</a>() &amp;&amp;
<a name="l00156"></a>00156                 e-&gt;<a class="code" href="class_edge.html#a1cd4feb64d154b5fdeb008e904b75a51">tail</a>()-&gt;<a class="code" href="class_vertex.html#a4b7d24d9d68ea12c55cb2695dfb70766">iid</a>() == _tail-&gt;<a class="code" href="class_vertex.html#a4b7d24d9d68ea12c55cb2695dfb70766">iid</a>());
<a name="l00157"></a>00157         <span class="comment">//return (*_e) == (*e);</span>
<a name="l00158"></a>00158     }
<a name="l00159"></a>00159 };
<a name="l00160"></a>00160 
<a name="l00161"></a>00161 
<a name="l00162"></a>00162 <span class="keyword">inline</span> uint qHash(<span class="keyword">const</span> <a class="code" href="class_edge.html">Edge</a>&amp; key)
<a name="l00163"></a>00163 {
<a name="l00164"></a>00164     <span class="keywordflow">if</span> (key._head-&gt;<a class="code" href="class_vertex.html#a4b7d24d9d68ea12c55cb2695dfb70766">iid</a>() &gt; key._tail-&gt;<a class="code" href="class_vertex.html#a4b7d24d9d68ea12c55cb2695dfb70766">iid</a>())
<a name="l00165"></a>00165         <span class="keywordflow">return</span> qHash( ((quint64)key._head-&gt;<a class="code" href="class_vertex.html#a4b7d24d9d68ea12c55cb2695dfb70766">iid</a>()) &lt;&lt; 32 |
<a name="l00166"></a>00166                       (quint64)key._tail-&gt;<a class="code" href="class_vertex.html#a4b7d24d9d68ea12c55cb2695dfb70766">iid</a>() );
<a name="l00167"></a>00167     <span class="keywordflow">else</span>
<a name="l00168"></a>00168         <span class="keywordflow">return</span> qHash( ((quint64)key._tail-&gt;<a class="code" href="class_vertex.html#a4b7d24d9d68ea12c55cb2695dfb70766">iid</a>()) &lt;&lt; 32 |
<a name="l00169"></a>00169                       (quint64)key._head-&gt;iid() );
<a name="l00170"></a>00170 }
<a name="l00171"></a>00171 
<a name="l00172"></a>00172 <span class="preprocessor">#endif</span>
</pre></div></div>
</div>
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
     onmouseover="return searchBox.OnSearchSelectShow()"
     onmouseout="return searchBox.OnSearchSelectHide()"
     onkeydown="return searchBox.OnSearchSelectKey(event)">
<a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(0)"><span class="SelectionMark">&#160;</span>All</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(1)"><span class="SelectionMark">&#160;</span>Classes</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(2)"><span class="SelectionMark">&#160;</span>Namespaces</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(3)"><span class="SelectionMark">&#160;</span>Functions</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(4)"><span class="SelectionMark">&#160;</span>Variables</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(5)"><span class="SelectionMark">&#160;</span>Enumerations</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(6)"><span class="SelectionMark">&#160;</span>Enumerator</a></div>

<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<iframe src="javascript:void(0)" frameborder="0" 
        name="MSearchResults" id="MSearchResults">
</iframe>
</div>



<hr class="footer"/><address class="footer"><small>
Generated on Thu May 31 2012 16:19:51 for QSculpt by &#160;<a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/>
</a> 1.7.5.1
</small></address>

</body>
</html>
